public class LibrarySystemDemo {
    public static void main(String[] args) {
        LibraryManager library = new LibraryManager();

        Book book1 = new Book("9787115546026", "Java编程思想", "Bruce Eckel", "机械工业出版社");
        Book book2 = new Book("9787111641247", "数据结构与算法分析", "Mark Allen Weiss", "机械工业出版社");
        library.addBook(book1);
        library.addBook(book2);

        Reader reader1 = new Reader("R001", "张三", "13800138000");
        library.addReader(reader1);

        try {
            System.out.println("=== 测试正常借阅 ===");
            library.borrowBook("9787115546026", "R001");
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            System.out.println("\n=== 测试借阅已借出图书 ===");
            library.borrowBook("9787115546026", "R001");
        } catch (Exception e) {
            System.out.println("异常提示：" + e.getMessage());
        }

        try {
            System.out.println("\n=== 测试正常归还 ===");
            library.returnBook("9787115546026", "R001");
        } catch (Exception e) {
            e.printStackTrace();
        }

        System.out.println("\n=== 测试查询读者借阅记录 ===");
        library.getRecordsByReader("R001").forEach(record -> System.out.println(record));
    }
}